<!--
	作者：495246490@qq.com
	时间：2016-04-25
	描述：参数文案列表
-->
<h3>{{rootColumnName}}
    <small>{{rootColumnPrompt}}</small>
</h3>
<div class="btn-group">
    <button class="btn btn-primary big-big-font" ui-sref="cms.createCodeList">生成记录</button>
    <button class="btn btn-default big-big-font" ui-sref="cms.useCodeList">使用记录</button>
</div>
<div  ng-controller="createCodeListCtrl" class="panel panel-default">
    <div class="col-sm-12">
        <div class="panel-heading">
            <form class="form-inline">
                <div class="form-group">
                    <input type="text" ng-keyup="dataEvent($event)" ng-model="search" class="form-control" placeholder="{{searchplaceholder}}">
                </div>
                <button type="button" ui-sref="cms.addCoursesCode()" class="btn btn-labeled btn-success pull-right">
                    <span class="btn-label">
                        <i class="fa fa-plus"></i>
                    </span>生成新码
                </button>
            </form>
        </div>
    </div>
    <div class="panel-body " ng-class="loading?'whirl standard':'' " style="border-top: 1px solid #CFDBE2;">
        <table class="table table-striped table-condensed">
            <thead>
            <tr>
                <th>生成编号</th>
                <th>产品编号</th>
                <th>兑换产品</th>
                <th>操作人</th>
                <th>生成时间</th>
                <th>到期时间</th>
                <th>数量</th>
                <th>状态</th>
                <th>备注</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <!-- repeat begin -->
            <tr ng-repeat=" resultItem in result ">
                <td>{{resultItem.id}}</td>
                <td>{{resultItem.productId}}</td>
                <td ng-if="resultItem.type==2">幸会币充值卡({{resultItem.money}})</td>
                <td ng-if="resultItem.type==1" tooltip="{{resultItem.productName}}">{{resultItem.productName | limitToNum : 20}}</td>
                <td ng-if="resultItem.type==3" tooltip="开通会员兑换">开通会员兑换</td>
                <td>{{resultItem.cmsuser.name}}</td>
                <td>{{resultItem.createTime}}</td>
                <td>{{resultItem.expirationTime}}</td>
                <td>{{resultItem.dhNumber}}/{{resultItem.number}}</td>
                <td>{{findStatus(resultItem.status,resultItem.createTime,resultItem.expirationTime)}}</td>
                <td>{{resultItem.remark | limitToNum : 10}}</td>
                <td>
                    <a tooltip="查看" tooltip-trigger="mouseenter" class="btn btn-xs btn-primary" ui-sref="cms.codeDetail({cdkeyInfoId:resultItem.id})"><i class="fa fa-eye"></i></a>
                    <button ng-if="resultItem.status==2" tooltip="激活" tooltip-trigger="mouseenter" class="btn btn-xs btn-primary" ng-click="doCode(resultItem.id,1)">激活</button>
                    <button ng-if="resultItem.status==1" tooltip="冻结" tooltip-trigger="mouseenter" class="btn btn-xs btn-warning" ng-click="doCode(resultItem.id,2)">冻结</button>
                </td>
            </tr>
            <!-- repeat end -->
            </tbody>
        </table>
        <p style="display: inline-block; margin:21px 0;height: 30px;line-height: 30px;"> 显示 <strong>{{turnPage.totalItems}}</strong> 条中的 <strong>{{turnPage.itemsPerPage*(turnPage.currentPage-1)+1}}-{{ToNum}}</strong> 条</p>
        <pagination class="pull-right" first-text="{{turnPage.firstText}}" previous-text="{{turnPage.previousText}}" next-text="{{turnPage.nextText}}" last-text="{{turnPage.lastText}}" total-items="turnPage.totalItems" ng-model="turnPage.currentPage" max-size="turnPage.maxSize"
                    num-pages="numPages" boundary-links="true" ng-change="dataChange()" class="pagination-sm">
        </pagination>
    </div>
</div>